package com.mz.mattress.client.task;

import lombok.Data;

import java.io.Serializable;

@Data
public class CommTaskBean<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 具体的任务处理器
     */
    private TaskHandler<T> taskHandler;

    private T data;

    private long time;

    public CommTaskBean(TaskHandler<T> taskHandler, T data) {
        this.taskHandler = taskHandler;
        this.data = data;
    }

    public void start() {
        taskHandler.handler(data);
    }

}
